package com.doudou.collection.adapter.controller.admin.system;

import com.doudou.collection.domain.service.admin.SysMenuService;
import com.doudou.collection.infrastructure.common.pojo.vo.TreeSelect;
import com.doudou.collection.infrastructure.common.security.SecurityUtils;
import com.doudou.collection.infrastructure.common.web.ResultVO;
import com.doudou.collection.orm.vo.admin.SysMenuListVO;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName SysMenuController
 * @Description 菜单管理
 * @Author blue sky
 * @Date 2023/7/3 23:12
 * @Version 1.0
 */
@Slf4j
@RestController
@Api(tags = "14.角色管理模块")
@RequestMapping("/prod-api/system/menu")
public class SysMenuController {

    @Autowired
    private SysMenuService sysMenuService;

    @GetMapping("/treeselect")
    public ResultVO treeselect() {
        log.debug("开始处理【获取菜单下拉树列表】的请求");
        List<SysMenuListVO> list = sysMenuService.listMenuOptions(SecurityUtils.getUserId());
        List<TreeSelect> tree = sysMenuService.buildMenuTreeSelect(list);
        return ResultVO.ok(tree);
    }
}












